package learn.euraka.consumer.web.controller;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

import javax.annotation.Resource;

/**
 * @Author： xiami
 * @Date： Created in 2018-03-25 22:27
 * @Modified By：
 */
@RestController
public class ComputeConsumerController {

    private static Logger logger = LoggerFactory.getLogger(ComputeConsumerController.class);

    @Resource
    RestTemplate restTemplate;

    @GetMapping("/add")
    public String add() {
        String body = restTemplate.getForEntity("http://eureka-service/add?a=10&b=20", String.class).getBody();
        logger.debug("body = " + body);
        return body;
    }

}
